package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 系统管理员类
 *
 * @author liujiale
 */
public class SystemAdministrator extends Account {

    /** 系统管理员ID */
    private int systemAdminID;

    /**
     * 构造函数
     *
     * @param systemAdminID 系统管理员ID
     */
    public SystemAdministrator(int systemAdminID) {
        this.systemAdminID = systemAdminID;
    }

    /**
     * 实现父类的构造函数
     *
     * @param username      用户名
     * @param password      密码
     * @param nickname      昵称
     * @param telephone     电话
     * @param email         邮箱
     * @param createTime    账户创建时间
     * @param systemAdminID 系统管理员ID
     */
    public SystemAdministrator(String username, String password, String nickname, String telephone, String email, Date createTime, int systemAdminID) {
        super(username, password, nickname, telephone, email, createTime);
        this.systemAdminID = systemAdminID;
    }

    /**
     * Gets system admin id.
     *
     * @return the system admin id
     */
    public int getSystemAdminID() {
        return systemAdminID;
    }

    /**
     * Sets system admin id.
     *
     * @param systemAdminID the system admin id
     */
    public void setSystemAdminID(int systemAdminID) {
        this.systemAdminID = systemAdminID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof SystemAdministrator)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        SystemAdministrator that = (SystemAdministrator) o;
        return systemAdminID == that.systemAdminID;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), systemAdminID);
    }

    @Override
    public String toString() {
        return "SystemAdministrator{" +
                "systemAdminID=" + systemAdminID +
                '}';
    }
}
